package cn.moukou.sbzz.config;

import cn.moukou.sbzz.interceptor.BankInterceptor;
import cn.moukou.sbzz.interceptor.CorsInterceptor;
import cn.moukou.sbzz.interceptor.EnterpriseInterceptor;
import cn.moukou.sbzz.interceptor.TokenAuthInterceptor;
import cn.moukou.sbzz.service.BankProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Autowired
    CorsInterceptor corsInterceptor;
    @Autowired
    TokenAuthInterceptor tokenAuthInterceptor;
    @Autowired
    EnterpriseInterceptor enterpriseInterceptor;
    @Autowired
    BankInterceptor bankInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(corsInterceptor)
                .addPathPatterns("/sbzz/api/**").order(100);
        registry.addInterceptor(tokenAuthInterceptor)
                .addPathPatterns("/sbzz/api/**").excludePathPatterns("/sbzz/api/login/**").order(200);
//        registry.addInterceptor(enterpriseInterceptor)
//                .addPathPatterns("/sbzz/api/bank/product/filter").order(300);
//        registry.addInterceptor(bankInterceptor)
//                .addPathPatterns("/sbzz/api/enterprise/product/filter").order(300);
    }
}
